package ${package.Controller};
import org.springframework.web.bind.annotation.RequestMapping;
import com.common.project.util.WrapperUtil;
<#if restControllerStyle>
import org.springframework.web.bind.annotation.RestController;
<#else>
import org.springframework.stereotype.Controller;
</#if>
<#if superControllerClassPackage??>
import ${superControllerClassPackage};
</#if>
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
<#if swagger2>
import io.swagger.annotations.*;
</#if>
import ${package.Entity}.${entity};
import ${package.Service}.${table.serviceName};
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import lombok.extern.log4j.Log4j2;
import com.common.project.util.Result;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.common.project.util.ExcelUtiles;
/**
 * <p>
 * ${table.comment!} 前端控制器
 * </p>
 *
 * @author ${author}
 * @since ${date}
 */
@Log4j2
<#if restControllerStyle>
@Api(tags={"${table.comment}"})
@RestController
<#else>
@Controller
</#if>
@RequestMapping("<#if package.ModuleName??>/${package.ModuleName}</#if>/<#if controllerMappingHyphenStyle??>${controllerMappingHyphen}<#else>${table.entityPath}</#if>")
<#if kotlin>
class ${table.controllerName}<#if superControllerClass??> : ${superControllerClass}()</#if>
<#else>
<#if superControllerClass??>
public class ${table.controllerName} extends ${superControllerClass} {
<#else>
public class ${table.controllerName} {
</#if>
     @Autowired
    private ${table.serviceName} ${'${table.serviceName}'?uncap_first};

    /**
     * 无条件翻页查询
     */
    @ApiOperation(value = "无条件翻页查询")
    @ApiResponses({
            @ApiResponse(code = 200,message = "操作成功"),
            @ApiResponse(code = 404,message = "请求路径没有或页面跳转路径不对"),
            @ApiResponse(code = 500,message = "操作异常"),
    })
    @RequestMapping(value = "/page", method = RequestMethod.GET)
    public Result<IPage<${entity}>> page(@RequestParam(defaultValue = "1",required = false) Integer pageNo,@RequestParam(defaultValue = "10",required = false) Integer pageSize){
        try {
            Page<${entity}> page=new Page<>();
            page.setCurrent(pageNo==null?1:pageNo);
            page.setSize(pageSize==null?10:pageSize);
            return new Result<IPage<${entity}>>(200, "无条件翻页查询成功",${'${table.serviceName}'?uncap_first}.page(page));
        } catch (Exception e) {
            log.error("无条件翻页查询异常: "+e.getMessage(),e);
            return new Result<IPage<${entity}>>(500, "无条件翻页查询异常: "+e.getMessage());
        }
    }

    /**
     * 翻页查询
     */
    @ApiOperation(value = "翻页查询")
    @ApiResponses({
            @ApiResponse(code = 200,message = "操作成功"),
            @ApiResponse(code = 404,message = "请求路径没有或页面跳转路径不对"),
            @ApiResponse(code = 500,message = "操作异常"),
    })
    @RequestMapping(value = "/pageQueryWarapper", method = RequestMethod.POST)
    public Result<IPage<${entity}>> pageQueryWarapper(){
        try {
            Page<${entity}> page=new Page<>();
            page.setCurrent(1);
            page.setSize(2);

            LambdaQueryWrapper<${entity}> queryWrapper = new QueryWrapper<${entity}>()
                    .lambda()
                    .select(${entity}::getUserName, ${entity}::getAge)
                    .eq(${entity}::getAge, 28);
            return new Result<IPage<${entity}>>(200, "翻页查询成功",${'${table.serviceName}'?uncap_first}.page(page,queryWrapper));
        } catch (Exception e) {
            log.error("翻页查询异常: "+e.getMessage(),e);
            return new Result<IPage<${entity}>>(500, "翻页查询异常: "+e.getMessage());
        }
    }
    /**
     * 查询所有列表
     */
    @ApiOperation(value = "查询所有列表")
    @ApiResponses({
            @ApiResponse(code = 200,message = "操作成功"),
            @ApiResponse(code = 404,message = "请求路径没有或页面跳转路径不对"),
            @ApiResponse(code = 500,message = "操作异常"),
    })
    @RequestMapping(value = "/listMaps", method = RequestMethod.GET)
    public Result<List<Map<String, Object>>> listMaps(){
        try {
            return new Result<List<Map<String, Object>>>(200, "查询所有列表成功",${'${table.serviceName}'?uncap_first}.listMaps());
        } catch (Exception e) {
            log.error("查询所有列表异常: "+e.getMessage(),e);
            return new Result<List<Map<String, Object>>>(500, "查询所有列表异常: "+e.getMessage());
        }
    }

    /**
     * 查询全部记录
     */
    @ApiOperation(value = "查询全部记录")
    @ApiResponses({
            @ApiResponse(code = 200,message = "操作成功"),
            @ApiResponse(code = 404,message = "请求路径没有或页面跳转路径不对"),
            @ApiResponse(code = 500,message = "操作异常"),
    })
    @RequestMapping(value = "/listObjs", method = RequestMethod.POST)
    public Result<List> listObjs(){
        try {
             LambdaQueryWrapper<${entity}> queryWrapper = new QueryWrapper<${entity}>()
                    .lambda()
                    .select(${entity}::getUserName, ${entity}::getAge)
                    .eq(${entity}::getAge, 28);

            return new Result<List>(200, "查询全部记录成功",${'${table.serviceName}'?uncap_first}.listObjs(queryWrapper));
        } catch (Exception e) {
            log.error("查询全部记录异常: "+e.getMessage(),e);
            return new Result<List>(500, "查询全部记录异常: "+e.getMessage());
        }
    }

    /**
     * 查询全部记录
     */
    @ApiOperation(value = "查询全部记录")
    @ApiResponses({
            @ApiResponse(code = 200,message = "操作成功"),
            @ApiResponse(code = 404,message = "请求路径没有或页面跳转路径不对"),
            @ApiResponse(code = 500,message = "操作异常"),
    })
    @RequestMapping(value = "/listObjsQueryWrapper", method = RequestMethod.POST)
    public Result<List<Object>> listObjsQueryWrapper(){
        try {
            LambdaQueryWrapper<${entity}> queryWrapper = new QueryWrapper<${entity}>()
                    .lambda()
                    .select(${entity}::getUserName, ${entity}::getAge)
                    .eq(${entity}::getAge, 28);
            return new Result<List<Object>>(200, "查询全部记录成功",${'${table.serviceName}'?uncap_first}.listObjs(queryWrapper));
        } catch (Exception e) {
            log.error("查询全部记录异常: "+e.getMessage(),e);
            return new Result<List<Object>>(500, "查询全部记录异常: "+e.getMessage());
        }
    }

    /**
     * 无条件翻页查询
     */
    @ApiOperation(value = "无条件翻页查询")
    @ApiResponses({
            @ApiResponse(code = 200,message = "操作成功"),
            @ApiResponse(code = 404,message = "请求路径没有或页面跳转路径不对"),
            @ApiResponse(code = 500,message = "操作异常"),
    })
    @RequestMapping(value = "/pageMaps", method = RequestMethod.POST)
    public Result<IPage<Map<String, Object>>> pageMaps(){
        try {
            Page<${entity}> page=new Page<>();
            page.setCurrent(1);
            page.setSize(2);
            return new Result<IPage<Map<String, Object>>>(200, "无条件翻页查询成功",${'${table.serviceName}'?uncap_first}.pageMaps(page));
        } catch (Exception e) {
            log.error("无条件翻页查询异常: "+e.getMessage(),e);
            return new Result<IPage<Map<String, Object>>>(500, "无条件翻页查询异常: "+e.getMessage());
        }
    }


    /**
     * 根据id查询
     */
    @ApiOperation(value = "根据id查询数据")
    @ApiResponses({
            @ApiResponse(code = 200,message = "操作成功"),
            @ApiResponse(code = 404,message = "请求路径没有或页面跳转路径不对"),
            @ApiResponse(code = 500,message = "操作异常"),
    })
    @RequestMapping(value = "/getById", method = RequestMethod.GET)
    public Result<${entity}> getById(@RequestParam("pkid") String pkid){
        try {
            return new Result<${entity}>(200, "查询成功",${'${table.serviceName}'?uncap_first}.getById(pkid));
        } catch (Exception e) {
            log.error("根据id查询数据: "+e.getMessage(),e);
            return new Result<${entity}>(500, "根据id查询数据异常: "+e.getMessage());
        }
    }

    /**
     * 查询（根据ID 批量查询）
     */
    @ApiOperation(value = "根据ID 批量查询")
    @ApiResponses({
            @ApiResponse(code = 200,message = "操作成功"),
            @ApiResponse(code = 404,message = "请求路径没有或页面跳转路径不对"),
            @ApiResponse(code = 500,message = "操作异常"),
    })
    @RequestMapping(value = "/listByIds", method = RequestMethod.POST)
    public Result<Collection<${entity}>> listByIds(@RequestBody List<String> idList){
        try {
            if(null==idList||idList.size()==0){
                throw new RuntimeException("idList 不能为空");
            }
            return new Result<Collection<${entity}>>(200, "根据ID 批量查询成功",${'${table.serviceName}'?uncap_first}.listByIds(idList));
        } catch (Exception e) {
            log.error("根据ID 批量查询 异常: "+e.getMessage(),e);
            return new Result<Collection<${entity}>>(500, "根据ID 批量查询 异常: "+e.getMessage());
        }
    }

    /**
     * 查询（根据 columnMap 条件）
     */
    @ApiOperation(value = "根据 columnMap 条件查询")
    @ApiResponses({
            @ApiResponse(code = 200,message = "操作成功"),
            @ApiResponse(code = 404,message = "请求路径没有或页面跳转路径不对"),
            @ApiResponse(code = 500,message = "操作异常"),
    })
    @RequestMapping(value = "/listByMap", method = RequestMethod.POST)
    public Result<Collection<${entity}>> listByMap(@RequestBody Map<String, Object> columnMap){
        try {
            return new Result<Collection<${entity}>>(200, "根据 columnMap 条件查询成功",${'${table.serviceName}'?uncap_first}.listByMap(columnMap));
        } catch (Exception e) {
            log.error("根据 columnMap 条件查询 异常: "+e.getMessage(),e);
            return new Result<Collection<${entity}>>(500, "根据 columnMap 条件查询 异常: "+e.getMessage());
        }
    }
    /**
     * 根据 Wrapper，查询一条记录
     */
    @ApiOperation(value = "根据 Wrapper，查询一条记录")
    @ApiResponses({
            @ApiResponse(code = 200,message = "操作成功"),
            @ApiResponse(code = 404,message = "请求路径没有或页面跳转路径不对"),
            @ApiResponse(code = 500,message = "操作异常"),
    })
    @RequestMapping(value = "/getOne", method = RequestMethod.POST)
    public Result<${entity}> getOne(@RequestBody Map<String, Object> paramMap){
        try {

        QueryWrapper<${entity}> queryWrapper = QueryWrapperUtil.getQueryWarapper(paramMap, "${entity}");
            return new Result<${entity}>(200, "根据 Wrapper，查询一条记录成功",${'${table.serviceName}'?uncap_first}.getOne(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            log.error("根据 Wrapper，查询一条记录 异常: "+e.getMessage(),e);
            return new Result<${entity}>(500, "根据 Wrapper，查询一条记录 异常: "+e.getMessage());
        }
    }
    /**
     * 查询所有
     */
    @ApiOperation(value = "查询所有")
    @ApiResponses({
            @ApiResponse(code = 200,message = "操作成功"),
            @ApiResponse(code = 404,message = "请求路径没有或页面跳转路径不对"),
            @ApiResponse(code = 500,message = "操作异常"),
    })
    @RequestMapping(value = "/list", method = RequestMethod.POST)
    public Result<List<${entity}>> list(@RequestBody Map<String, Object> paramMap){
        try {
            QueryWrapper<${entity}> queryWrapper = QueryWrapperUtil.getQueryWarapper(paramMap, "${entity}");
            return new Result<List<${entity}>>(200, "查询所有成功",${'${table.serviceName}'?uncap_first}.list(queryWrapper));
        } catch (Exception e) {
            log.error("查询所有异常: "+e.getMessage(),e);
            return new Result<List<${entity}>>(500, "查询所有 异常: "+e.getMessage());
        }
    }
    /**
     * 根据 Wrapper 条件，查询总记录数
     */
    @ApiOperation(value = "根据 Wrapper 条件，查询总记录数")
    @ApiResponses({
            @ApiResponse(code = 200,message = "操作成功"),
            @ApiResponse(code = 404,message = "请求路径没有或页面跳转路径不对"),
            @ApiResponse(code = 500,message = "操作异常"),
    })
    @RequestMapping(value = "/countByQueryWrapper", method = RequestMethod.POST)
    public Result<Integer> countByQueryWrapper(@RequestBody Map<String, Object> paramMap){
        try {
            QueryWrapper<User> queryWrapper = QueryWrapperUtil.getQueryWarapper(paramMap, "${entity}");
            return new Result<Integer>(200, "根据 Wrapper 条件，查询总记录数成功",${'${table.serviceName}'?uncap_first}.count(queryWrapper));
        } catch (Exception e) {
            log.error("根据 Wrapper 条件，查询总记录数 异常: "+e.getMessage(),e);
            return new Result<Integer>(500, "根据 Wrapper 条件，查询总记录数 异常: "+e.getMessage());
        }
    }

    /**
     * 查询总记录数
     */
    @ApiOperation(value = "查询总记录数")
    @ApiResponses({
            @ApiResponse(code = 200,message = "操作成功"),
            @ApiResponse(code = 404,message = "请求路径没有或页面跳转路径不对"),
            @ApiResponse(code = 500,message = "操作异常"),
    })
    @RequestMapping(value = "/count", method = RequestMethod.GET)
    public Result<Integer> count(){
        try {
            return new Result<Integer>(200, "查询总记录数成功",${'${table.serviceName}'?uncap_first}.count());
        } catch (Exception e) {
            log.error("查询总记录数异常: "+e.getMessage(),e);
            return new Result<Integer>(500, "查询总记录数异常: "+e.getMessage());
        }
    }

    /**
     * 根据 Wrapper，查询一条记录
     */
    @ApiOperation(value = "根据 Wrapper，查询一条记录")
    @ApiResponses({
            @ApiResponse(code = 200,message = "操作成功"),
            @ApiResponse(code = 404,message = "请求路径没有或页面跳转路径不对"),
            @ApiResponse(code = 500,message = "操作异常"),
    })
    @RequestMapping(value = "/getMap", method = RequestMethod.POST)
    public Result<Map<String, Object>> getMap(@RequestBody Map<String, Object> paramMap){
        try {
            QueryWrapper<User> queryWrapper = QueryWrapperUtil.getQueryWarapper(paramMap, "${entity}");
            return new Result<Map<String, Object>>(200, "根据 Wrapper，查询一条记录成功",${'${table.serviceName}'?uncap_first}.getMap(queryWrapper));
        } catch (Exception e) {
            log.error("根据 Wrapper，查询一条记录 异常: "+e.getMessage(),e);
            return new Result<Map<String, Object>>(500, "根据 Wrapper，查询一条记录 异常: "+e.getMessage());
        }
    }
    /**
     * 插入一条记录（选择字段，策略插入）
     */
    @ApiOperation(value = "新增数据")
    @ApiResponses({
            @ApiResponse(code = 200,message = "操作成功"),
            @ApiResponse(code = 404,message = "请求路径没有或页面跳转路径不对"),
            @ApiResponse(code = 500,message = "操作异常"),
    })
    @RequestMapping(value = "/save", method = RequestMethod.POST)
    public Result<Boolean> save(@RequestBody ${entity} ${entity}){
        try {
            return new Result<Boolean>(200, "新增数据成功",${'${table.serviceName}'?uncap_first}.save(${entity}));
        } catch (Exception e) {
            log.error("新增数据异常: "+e.getMessage(),e);
            return new Result<Boolean>(500, "新增数据异常: "+e.getMessage());
        }
    }

    /**
     *  插入（批量）实体对象集合
     */
    @ApiOperation(value = "批量插入数据")
    @ApiResponses({
            @ApiResponse(code = 200,message = "操作成功"),
            @ApiResponse(code = 404,message = "请求路径没有或页面跳转路径不对"),
            @ApiResponse(code = 500,message = "操作异常"),
    })
    @RequestMapping(value = "/saveBatch", method = RequestMethod.POST)
    public Result<Boolean> saveBatch(@RequestBody List<${entity}> entityList){
        try {
            return new Result<Boolean>(200, "批量插入数据成功",${'${table.serviceName}'?uncap_first}.saveBatch(entityList));
        } catch (Exception e) {
            log.error("批量插入数据异常: "+e.getMessage(),e);
            return new Result<Boolean>(500, "批量插入数据异常: "+e.getMessage());
        }
    }

    /**
     * 删除
     */
    @ApiOperation(value = "删除数据")
    @ApiResponses({
            @ApiResponse(code = 200,message = "操作成功"),
            @ApiResponse(code = 404,message = "请求路径没有或页面跳转路径不对"),
            @ApiResponse(code = 500,message = "操作异常"),
    })
    @RequestMapping(value = "/del", method = RequestMethod.POST)
    public Result<Boolean> delete(@RequestBody List<String> ids){
        try {
            return new Result<Boolean>(200, "删除数据异常成功",null);
        } catch (Exception e) {
            log.error("删除数据异常: "+e.getMessage(),e);
            return new Result<Boolean>(500, "删除数据异常: "+e.getMessage());
        }
    }
    /**
     * 删除（根据ID 批量删除）
     */
    @ApiOperation(value = "根据ID 批量删除")
    @ApiResponses({
            @ApiResponse(code = 200,message = "操作成功"),
            @ApiResponse(code = 404,message = "请求路径没有或页面跳转路径不对"),
            @ApiResponse(code = 500,message = "操作异常"),
    })
    @RequestMapping(value = "/removeByIds", method = RequestMethod.POST)
    public Result<Boolean> removeByIds(@RequestBody List<String> idList){
        try {
            return new Result<Boolean>(200, "根据ID 批量删除成功",${'${table.serviceName}'?uncap_first}.removeByIds(idList));
        } catch (Exception e) {
            log.error("根据ID 批量删除异常: "+e.getMessage(),e);
            return new Result<Boolean>(500, "根据ID 批量删除异常: "+e.getMessage());
        }
    }

    /**
     * 根据ID修改
     */
    @ApiOperation(value = "根据ID修改")
    @ApiResponses({
            @ApiResponse(code = 200,message = "操作成功"),
            @ApiResponse(code = 404,message = "请求路径没有或页面跳转路径不对"),
            @ApiResponse(code = 500,message = "操作异常"),
    })
    @RequestMapping(value = "/updateById", method = RequestMethod.POST)
    public Result<Boolean> updateById(@RequestBody ${entity} ${entity}){
        try {
            return new Result<Boolean>(200, "根据ID修改成功",${'${table.serviceName}'?uncap_first}.updateById(${entity}));
        } catch (Exception e) {
            log.error("根据ID修改异常: "+e.getMessage(),e);
            return new Result<Boolean>(500, "根据ID修改异常: "+e.getMessage());
        }
    }

    /**
     * 根据 UpdateWrapper 条件，更新记录 需要设置sqlset
     */
    @ApiOperation(value = "根据 UpdateWrapper 条件，更新记录 需要设置sqlset")
    @ApiResponses({
            @ApiResponse(code = 200,message = "操作成功"),
            @ApiResponse(code = 404,message = "请求路径没有或页面跳转路径不对"),
            @ApiResponse(code = 500,message = "操作异常"),
    })
    @RequestMapping(value = "/updateByWrapper", method = RequestMethod.POST)
    public Result<Boolean> updateByWrapper(@RequestBody Map<String, Object> paramMap){
        try {
            UpdateWrapper<${entity}> updateWrapper = WrapperUtil.getUpdateWrapper(paramMap, "${entity}");
            return new Result<Boolean>(200, "根据 UpdateWrapper 条件，更新记录 需要设置sqlset成功",${'${table.serviceName}'?uncap_first}.update(updateWrapper));
        } catch (Exception e) {
            log.error("根据 UpdateWrapper 条件，更新记录 需要设置sqlset异常: "+e.getMessage(),e);
            return new Result<Boolean>(500, "根据 UpdateWrapper 条件，更新记录 需要设置sqlset异常: "+e.getMessage());
        }
    }

    /**
     * 根据ID 批量更新
     */
    @ApiOperation(value = "根据ID 批量更新")
    @ApiResponses({
            @ApiResponse(code = 200,message = "操作成功"),
            @ApiResponse(code = 404,message = "请求路径没有或页面跳转路径不对"),
            @ApiResponse(code = 500,message = "操作异常"),
    })
    @RequestMapping(value = "/updateBatchById", method = RequestMethod.POST)
    public Result<Boolean> updateBatchById(@RequestBody List<${entity}> entityList){
        try {
            return new Result<Boolean>(200, "根据ID 批量更新",${'${table.serviceName}'?uncap_first}.updateBatchById(entityList));
        } catch (Exception e) {
            log.error("根据ID 批量更新异常: "+e.getMessage(),e);
            return new Result<Boolean>(500, "根据ID 批量更新异常: "+e.getMessage());
        }
    }

    /**
     * TableId 注解存在更新记录，否插入一条记录
     */
    @ApiOperation(value = "TableId 注解存在更新记录，否插入一条记录")
    @ApiResponses({
            @ApiResponse(code = 200,message = "操作成功"),
            @ApiResponse(code = 404,message = "请求路径没有或页面跳转路径不对"),
            @ApiResponse(code = 500,message = "操作异常"),
    })
    @RequestMapping(value = "/saveOrUpdate", method = RequestMethod.POST)
    public Result<Boolean> saveOrUpdate(@RequestBody ${entity} entity){
        try {
            return new Result<Boolean>(200, "TableId 注解存在更新记录，否插入一条记录,执行成功",${'${table.serviceName}'?uncap_first}.saveOrUpdate(entity));
        } catch (Exception e) {
            log.error("TableId 注解存在更新记录，否插入一条记录执行异常: "+e.getMessage(),e);
            return new Result<Boolean>(500, "TableId 注解存在更新记录，否插入一条记录执行异常: "+e.getMessage());
        }
    }


    /**
     * 批量修改插入
     */
    @ApiOperation(value = "批量修改插入")
    @ApiResponses({
            @ApiResponse(code = 200,message = "操作成功"),
            @ApiResponse(code = 404,message = "请求路径没有或页面跳转路径不对"),
            @ApiResponse(code = 500,message = "操作异常"),
    })
    @RequestMapping(value = "/saveOrUpdateBatch", method = RequestMethod.POST)
    public Result<Boolean> saveOrUpdateBatch(@RequestBody List<${entity}> entityList){
        try {
            return new Result<Boolean>(200, "批量修改插入成功",${'${table.serviceName}'?uncap_first}.saveOrUpdateBatch(entityList));
        } catch (Exception e) {
            log.error("批量修改插入异常: "+e.getMessage(),e);
            return new Result<Boolean>(500, "批量修改插入异常: "+e.getMessage());
        }
    }

    @ApiOperation(value = "导出Excel模板", produces = "application/octet-stream",notes = "返回值说明: ")
    @GetMapping("outPutMode")
    public String outPutMode(HttpServletResponse response) {
        return  ${'${table.serviceName}'?uncap_first}.outPutMode(response);
    }

    @ApiOperation(value = "导入Excel模板",notes = "返回值说明: ")
    @PostMapping(value = "inPutMode",consumes = "multipart/*",headers = "content-type=multipart/form-data")
    @ResponseBody
    public boolean inPutMode(@ApiParam(value = "上传的文件",required = true) MultipartFile file, HttpServletRequest request) {
        return  ${'${table.serviceName}'?uncap_first}.inPutMode(file,request);
    }

    @ApiOperation(value = "导出Excel", produces = "application/octet-stream",notes = "返回值说明: ")
    @PostMapping("outPut")
    public String outPut(@RequestBody Map<String, Object> paramMap,HttpServletResponse response) {
        String msg="";
        try {
            QueryWrapper<${entity}> queryWrapper = WrapperUtil.getQueryWarapper(paramMap, "${entity}");
            List<${entity}> users = userService.list(queryWrapper);
            ExcelUtiles.exportExcel(users,"${table.comment}","${table.comment}",${entity}.class,"${table.comment}.xls",true,response);
            msg="导出成功";
        } catch (Exception e) {
            log.error("导出异常: "+e.getMessage(),e);
            msg="导出异常";
        }
        return  msg;
    }

    @ApiOperation(value = "导入Excel",notes = "返回值说明: ")
    @PostMapping(value = "inPut",consumes = "multipart/*",headers = "content-type=multipart/form-data")
    @ResponseBody
    public String inPut(@ApiParam(value = "上传的文件",required = true) MultipartFile file, HttpServletRequest request) {
        String msg="";
        try {
            //titleRows：表头位置 在第几行 0 就是第一行  titleHeader：表头有几行   1 1  第一列 第一行
            List<${entity}> userPos = ExcelUtiles.importExcel(file, 0, 1, ${entity}.class);
            msg="导出成功";
        } catch (Exception e) {
            log.error("导出异常: "+e.getMessage(),e);
            msg="导出异常";
        }
        return  msg;
    }

}
</#if>
